# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-other
pkgname=kio-fuse
pkgver=5.1.0
pkgrel=1
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://kde.org/"
pkgdesc="FUSE interface for KIO"
license="GPL-3.0-only"
makedepends="
	extra-cmake-modules
	fuse3-dev
	kcoreaddons-dev
	kdbusaddons-dev
	kio-dev
	qt6-qtbase-dev
	samurai
	"
checkdepends="dbus"
_repo_url="https://invent.kde.org/system/kio-fuse.git"
source="https://download.kde.org/stable/kio-fuse/kio-fuse-$pkgver.tar.xz
	modules-load.conf
	kio-fuse.desktop
	"
install="$pkgname.post-install"
options="!check" # Only test is broken

build() {
	cmake -B build -G Ninja \
		-DBUILD_WITH_QT6=ON \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -Dm644 "$srcdir"/modules-load.conf "$pkgdir"/usr/lib/modules-load.d/kio-fuse.conf
	install -Dm644 "$srcdir"/kio-fuse.desktop -t "$pkgdir"/etc/xdg/autostart/

	# We don't ship systemd
	rm -r "$pkgdir"/usr/lib/tmpfiles.d
	rm -r "$pkgdir"/usr/lib/systemd
}

sha512sums="
273b75fe90f8cb31ee0f611716bf05384d78d21747cb43785bb7a91037ca9ac30233aee5081e467d46aa21aa03f4c0fc7583334fe34dec7530c89c818db41a4b  kio-fuse-5.1.0.tar.xz
57d23d2778556eafc3035e6be575bf95b4032f123b35f2b1657eff5e7496de253173edc657f90531ee58e25673f4f27a5cd1cc76b14a038edb244f104a231771  modules-load.conf
94a5acc6d6b622f923e6fa077cac63f365ad1a0828690336421368f7300179b39318b10c5e6490de7c442e2713dc25b2b3fb17fee4ac4064595a474ea50c2137  kio-fuse.desktop
"
